include config.mk

SUBDIRS = \
	HOC_cbits \
	HOC \
	InterfaceGenerator \
	Bindings \
	Foundation \
	AppKit \
	Tools \
	docs \
	$(NULL)

Samples_SUBDIRS = \
	Samples/Browser \
	Samples/Editor \
	Samples/ExpressionParser \
	Samples/UniqSort \
	$(NULL)

all_SUBDIRS = $(SUBDIRS) $(Samples_SUBDIRS)

dist_srcdir = .
dist_FILES = \
	AUTHORS.txt \
	LICENSE \
	Makefile.in \
	README.txt \
	aclocal.m4 \
	autogen.sh \
	autotools \
	config.mk.in \
	configure \
	configure.ac \
	objc.m4 \
	$(NULL)

all: libffi-src/build/src/raw_api.o hoc-all

dist:
	-test -d "$(dist_dir)" && rm -rf "$(dist_dir)"
	$(MAKE) dist-recursive
	for dir in $(all_SUBDIRS); do (cd $$dir; $(MAKE) dist-recursive); done
	cp -HRp libffi-src "$(dist_dir)"
	rm -rf "$(dist_dir)"/libffi-src/build
	find "$(dist_dir)" -type d -name 'CVS' -exec rm -rf '{}' ';' -prune
	find "$(dist_dir)" -type d -name '*~'  -exec rm -rf '{}' ';' -prune
	tar jcvf @abs_top_builddir@/hoc-@PACKAGE_VERSION@.tar.bz2 \
	  ./hoc-@PACKAGE_VERSION@

distcheck: dist
	( cd "$(dist_dir)" && ./configure && make )

libffi-src/build/src/raw_api.o:
	( cd libffi-src/build && $(MAKE) )

hoc-all:
	for dir in $(SUBDIRS); do (cd $$dir; $(MAKE) all) done
	
clean:
	for dir in $(all_SUBDIRS); do (cd $$dir; $(MAKE) clean) done
	
install:
	for dir in $(SUBDIRS); do (cd $$dir; $(MAKE) install) done

.PHONY: samples
samples:
	for dir in $(Samples_SUBDIRS); do (cd $$dir; $(MAKE)) done

